home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / raytrace / rayshade / graphtal.lzh / Graphtal.Amiga / Sphere.h < prev    next >
C/C++ Source or Header  |  1992-11-19  |  1KB  |  50 lines

  1. /*
  2.  * Sphere.h - class definition for geometric object sphere.
  3.  *
  4.  * Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
  5.  *                     University of Berne, Switzerland
  6.  * Copyright (C) 1989, 1991, Craig E. Kolb
  7.  * All rights reserved.
  8.  *
  9.  * This software may be freely copied, modified, and redistributed
  10.  * provided that this copyright notice is preserved on all copies.
  11.  *
  12.  * You may not distribute this software, in whole or in part, as part of
  13.  * any commercial product without the express consent of the authors.
  14.  *
  15.  * There is no warranty or other guarantee of fitness of this software
  16.  * for any purpose.  It is provided solely "as is".
  17.  *
  18.  */
  19.  
  20. #ifndef Sphere_H
  21. # define Sphere_H
  22.  
  23. #include "GeoObject.h"
  24. #include "Polygon.h"
  25.  
  26. //___________________________________________________________ Sphere
  27.  
  28. class Sphere : public GeoObject 
  29. {
  30. public:
  31.   static GeoObject* create(real, const Vector&);
  32.  
  33.   int intersect(const Ray&, real, real&);
  34.   Vector normal(const Vector&) const;
  35.   PolygonList* tesselate(const BoundingBox&);
  36.  
  37.   static PolygonList* tesselation(const Vector&, real, int);
  38.   static Vector computeSurfacePoint(real, real);
  39.  
  40. private:
  41.   Sphere(real, const Vector&);
  42.  
  43. private:
  44.   real r;         // radius
  45.   real rsqr;      // radius squared
  46.   Vector center;  // position
  47. };
  48.  
  49. #endif // Sphere_H
  50.